package ch3oopexer1;
/*4：用oop的思想模拟 狗咬吕洞宾,不识好人心；
  狗咬刺猬，无从下口；狗咬狗，一嘴毛.相关类用构造方法初始化属性（方法都是咬，bite)

   狗有名字的属性，刺猬有名字的属性，好人有名字和性别属性*/
public class Dog {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.dName="大黄狗狗";
        Person person = new Person();
        person.pName="吕洞宾";
        CiWei ciWei = new CiWei();
        ciWei.cWName="刺猬";

        System.out.println(new Dog(dog));
        System.out.println(new Dog(person));
        System.out.println(new Dog(ciWei));
    }

    String dName;

    public Dog(){}
    public Dog (Dog dog){
        bite();
        System.out.println(dog.dName+"一嘴毛");
    }
    public Dog (Person peple){
        bite();
        System.out.println(peple.pName+"不识好人心");
    }
    public Dog (CiWei ciWei){
        bite();
        System.out.println(ciWei.cWName+"无从下口");
    }

    public void bite(){
        System.out.print(dName +"咬");
    }
}
class Person{
    String pName;
}
class CiWei{
    String cWName;
}